home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / qbnws204.zip / WINDOWS.ZIP / WINDOWER.ASM < prev    next >
Assembly Source File  |  1991-07-15  |  33KB  |  569 lines

  1. ; WINDOWER.ASM  This is a window management system, intended to be linked
  2. ;               with programs written in Microsoft high-level languages.
  3. ;               It can be used to draw and restore windows in a variety of
  4. ;               styles and colours. Windows can be zoomed onto the screen
  5. ;               and may have shadows to the left or right if required.  
  6. ;
  7. ;   Author:     Christy Gemmell    
  8. ;   For:        Assembly-Language ToolBox for QuickBASIC
  9. ;   Version:    5.00
  10. ;   Date:       17/6/1991
  11. ;
  12. ;   Compatible with QuickBASIC 4.x, Extended QuickBASIC and BASIC 7
  13. ;   Assembled with MicroSoft Macro Assembler, MASM version 5.1
  14. ;
  15. ;   Exploding and imploding windows implemented 17/6/91
  16. ;
  17. ;┌────────────────────────────────────────────────────────────────────────┐
  18. ;│      Global symbols and procedures.                                    │
  19. ;└────────────────────────────────────────────────────────────────────────┘
  20. ;
  21.                 .model  medium
  22.  
  23.                 extrn   Delay:proc
  24.                 extrn   Explode:proc
  25.                 extrn   ScreenAddress:proc
  26.                 extrn   ScreenCopy:proc
  27.                 extrn   ScreenWrite:proc
  28.                 extrn   VideoType:proc 
  29.                 extrn   WriteByte:proc
  30.  
  31.                 public  PopUp, ShutUp
  32.  
  33.                 .code
  34.  
  35. ;┌────────────────────────────────────────────────────────────────────────┐
  36. ;│      Data Division.                                                    │
  37. ;└────────────────────────────────────────────────────────────────────────┘
  38. ;
  39. Signature       db      ' WINDOW MANAGER By Christy Gemmell '
  40.  
  41. Ulc             label   word                    ; Upper left co-ordinate
  42. TlRow           db      ?                       ; Top left screen row
  43. TlCol           db      ?                       ; Top left screen column
  44. Lrc             label   word                    ; Lower right co-ordinate
  45. BrCol           db      ?                       ; Right column of window
  46. BrRow           db      ?                       ; Bottom row of window
  47. Area            label   word
  48. Breadth         db      ?                       ; Window width (inc shadow)
  49. Height          db      ?                       ; Window Height (inc shadow)
  50. ToDo            label   word
  51. Cols2do         db      ?                       ; Columns to restore
  52. Rows2do         db      ?                       ; Rows to restore
  53. Rows            db      ?                       ; Screen length in rows
  54. Columns         db      ?                       ; Screen width in columns
  55. Increment       dw      ?                       ; Interval between rows
  56. BuffPtr         dw      ?                       ; Pointer to current buffer
  57. BuffTop         dw      ?                       ; Offset of first buffer row
  58. BuffEnd         dw      ?                       ; Offset of last buffer row
  59. WinTop          dw      ?                       ; Offset of first screen row
  60. WinEnd          dw      ?                       ; Offset of last screen row
  61.  
  62. TopLeft         label   byte
  63.                 db      ' ┌╔╒╓╤╦┬╥'             ; TL Corner characters
  64. TopRight        label   byte
  65.                 db      ' ┐╗╕╖╤╦┬╥'             ; TR Corner characters
  66. BotLeft         label   byte
  67.                 db      ' └╚╘╙╘╚└╙'             ; BL Corner characters
  68. BotRight        label   byte
  69.                 db      ' ┘╝╛╜╛╝┘╜'             ; BR Corner characters
  70. Vertical        label   byte
  71.                 db      ' │║│║│║│║'             ; Vertical characters
  72. Horizontal      label   byte
  73.                 db      ' ─══─══──'             ; Horizontal characters
  74.  
  75. Buffer          label   byte                    ; Start of screen buffer
  76.                 db      4000h dup(0)
  77. BufferTop       dw      0                       ; End of screen Buffer
  78.  
  79. ;┌────────────────────────────────────────────────────────────────────────┐
  80. ;│      POPUP | Save a screen rectangle and replace it with a window.     │
  81. ;└────────────────────────────────────────────────────────────────────────┘
  82. ;
  83. PopUp           proc    far
  84.                 push    bp                      ; Save Base pointer
  85.                 mov     bp,sp                   ; Establish stack frame
  86.                 push    ds                      ; Preserve segment
  87.                 push    es                      ;    registers and
  88.                 push    di                      ;      index
  89.                 push    si                      ;        pointers
  90.                 call    VideoType               ; Get video parameters
  91.                 push    cs                      ; Align Code and
  92.                 pop     ds                      ;    Data segments
  93.                 mov     Rows,bl                 ; Store screen height
  94.                 mov     Columns,ah              ; Store screen width
  95.                 mov     al,ah                   ; Transfer number of
  96.                 xor     ah,ah                   ;    columns to AX
  97.                 shl     ax,1                    ;      and convert
  98.                 mov     Increment,ax            ;        to bytes
  99.                 mov     al,[bp+20]              ; Get top-left row
  100.                 dec     al                      ; Make it base zero
  101.                 cmp     al,0                    ; Check for
  102.                 jae     Pop_01                  ;    legal
  103.                 xor     al,al                   ;      values
  104. Pop_01:
  105.                 mov     TlRow,al                ; Save top-left row
  106.                 mov     al,[bp+18]              ; Get top-left column
  107.                 dec     al                      ; Make it base zero
  108.                 cmp     al,0                    ; Check for
  109.                 ja      Pop_02                  ;    legal
  110.                 mov     al,1                    ;      values
  111. Pop_02:
  112.                 mov     TlCol,al                ; Store top-left column
  113.                 mov     al,[bp+16]              ; Get window height
  114.                 cmp     al,2                    ; Check for
  115.                 ja      Pop_03                  ;    legal
  116.                 mov     al,3                    ;      values
  117. Pop_03:
  118.                 mov     [bp+16],al              ; Store window height
  119.                 mov     al,[bp+14]              ; Get window width
  120.                 cmp     al,2                    ; Check for
  121.                 ja      Pop_04                  ;    legal
  122.                 mov     al,3                    ;      values
  123. Pop_04:
  124.                 mov     [bp+14],al              ; Store window width
  125.                 mov     al,TlRow                ; Get start row
  126.                 mov     ah,[bp+16]              ; Get number of rows
  127.                 add     al,ah                   ; Add 'em together
  128.                 cmp     al,Rows                 ; Out of bounds?
  129.                 jb      Pop_05                  ; No, carry on
  130.                 jmp     Pop_38                  ; Else abort
  131. Pop_05:
  132.                 dec     al                      ; Store bottom
  133.                 mov     BrRow,al                ;    row number
  134.                 mov     al,TlCol                ; Get start column
  135.                 mov     ah,[bp+14]              ; Get number of columns
  136.                 add     al,ah                   ; Add 'em together
  137.                 cmp     al,Columns              ; Out of bounds?
  138.                 jb      Pop_06                  ; No, carry on
  139.                 jmp     Pop_38                  ; Else abort
  140. Pop_06:
  141.                 dec     al                      ; Store rightmost
  142.                 mov     BrCol,al                ;    column number
  143.                 mov     al,[bp+10]              ; Get required border type
  144.                 cmp     al,0                    ; Check
  145.                 jb      Pop_07                  ;    for
  146.                 cmp     al,8                    ;      legal
  147.                 ja      Pop_07                  ;        values
  148.                 jmp     short Pop_08
  149. Pop_07:
  150.                 mov     byte ptr [bp+10],1      ; Set default (single line)
  151. Pop_08:
  152.                 mov     ax,[bp+8]               ; See if shadow i